package com.aa.activity;

import com.aa.R;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.ImageButton;
import android.widget.TextView;

public class DialSettingActivity extends Activity implements OnClickListener{
	private Button mbtnTitleBack;
	private TextView mtvTitleCenter;
	private ImageButton mbtnCapacity;
	private ImageButton mbtnCallBack;
	private ImageButton mbtnZhiDial;
	private ImageButton mbtnVideo;
	
	boolean bcapacity = false;
	boolean bcallback = false;
	boolean bzhidial = false;
	boolean bvideo = false;
	@Override
	protected void onCreate(Bundle savedInstanceState) {		
		super.onCreate(savedInstanceState);
		setContentView(R.layout.dial_select);
		initView();
	}
	private void initView(){
		mbtnTitleBack = (Button)findViewById(R.id.btn_title_back);
		mbtnTitleBack.setOnClickListener(this);
		mtvTitleCenter = (TextView)findViewById(R.id.tv_title_center);
		mtvTitleCenter.setText(R.string.dial_setting);
		
		mbtnCallBack = (ImageButton)findViewById(R.id.btn_switch2);
		mbtnCallBack.setOnClickListener(this);
		mbtnCapacity = (ImageButton)findViewById(R.id.btn_switch4);
		mbtnCapacity.setOnClickListener(this);
		mbtnZhiDial = (ImageButton)findViewById(R.id.btn_switch1);
		mbtnZhiDial.setOnClickListener(this);
		mbtnVideo = (ImageButton)findViewById(R.id.btn_switch3);
		mbtnVideo.setOnClickListener(this);
		
	}
	@Override
	public void onClick(View v) {
		switch (v.getId()) {
		case R.id.btn_title_back:
			finish();
			break;
		case R.id.btn_switch1:
			
			if (!bzhidial) {
				mbtnZhiDial.setBackgroundResource(R.drawable.on);
				bzhidial = true;
			}else {
				mbtnZhiDial.setBackgroundResource(R.drawable.off);
				bzhidial = false;
			}
			
			break;
		case R.id.btn_switch2:
			
			if (!bcallback) {
				mbtnCallBack.setBackgroundResource(R.drawable.on);
				bcallback = true;
			}else {
				mbtnCallBack.setBackgroundResource(R.drawable.off);
				bcallback = false;
			}
			
			break;
		case R.id.btn_switch3:
			if (!bvideo) {
				mbtnVideo.setBackgroundResource(R.drawable.on);
				bvideo = true;
			}else {
				mbtnVideo.setBackgroundResource(R.drawable.off);
				bvideo = false;
			}
			break;
		case R.id.btn_switch4:
			if (!bcapacity) {
				mbtnCapacity.setBackgroundResource(R.drawable.on);
				bcapacity = true;
			}else {
				mbtnCapacity.setBackgroundResource(R.drawable.off);
				bcapacity = false;
			}
			break;

		default:
			break;
		}
		
	}
}
